<form method="post" action="${currentPath}">
	<p>
	<label>Choose a course: </label>
	<select name="courseId">
		<#list courses as course>
			<#if course.id == courseId>
				<option selected="selected" value="${course.id?c}">${course.id?c} - ${course.name}</option>
			<#else>
				<option  value="${course.id?c}">${course.id?c} - ${course.name}</option>
			</#if>
		</#list>
	</select>
	<input type="submit" value="Find sessions" />
	</p>
</form>

<div>
<#if sessions?has_content>
<table>
	<thead>
		<tr>
			<th>Id</th>
			<th>Name</th>
			<th>Date</th>
			<th>Attendant Records</th>
			<th>Generate Attendant Records</th>
		</tr>
	</thead>
	<tbody>
		<#list sessions as session>
			<tr>
				<td>${session.id?c}</td>
				<td>${session.name}</td>
				<td>${session.date}</td>
				<td><a href="${rootPath}/attendants/${courseId?c}/${session.id?c}">Attendant Records</a></td>
				<#if session.isHavingRecord == 0>
				<td>
					<#if credentials.isAdmin>
					<a href="${rootPath}/attendants/${courseId?c}/${session.id?c}/generaterecord">Generate Attendant Records</a>
					</#if>
				</td>
				</#if>
			</tr>
		</#list>
	</tbody>
</table>
<#else>
<h2>There is no session.</h2>
</#if>
</div>
